n=526; m=1000; q=3; belt=[|216,450| 326,226| 160,58| 216,98| 499,456| 490,405| 278,112| 94,25| 175,17| 73,278| 186,359| 298,495| 478,327| 122,432| 142,380| 254,421| 325,333| 192,135| 155,526| 327,129| 348,229| 331,350| 413,52| 138,305| 477,123| 169,324| 139,525| 73,121| 104,394| 260,307| 75,71| 397,84| 379,326| 491,370| 446,432| 454,475| 376,18| 205,285| 224,442| 328,504| 21,261| 42,230| 433,165| 276,405| 64,305| 383,409| 211,478| 207,357| 523,259| 9,487| 122,337| 137,228| 414,431| 505,166| 136,112| 133,457| 467,492| 499,31| 6,218| 178,401| 62,104| 33,223| 125,104| 337,276| 73,383| 52,478| 158,59| 257,99| 369,202| 453,323| 193,132| 392,211| 255,427| 222,190| 157,165| 4,517| 122,473| 18,24| 395,479| 142,115| 285,10| 314,116| 305,31| 282,86| 98,224| 35,132| 389,25| 428,294| 349,65| 440,241| 192,283| 243,417| 397,363| 137,207| 326,8| 447,33| 21,410| 346,45| 451,300| 39,23| 351,213| 494,147| 288,26| 363,35| 323,155| 454,171| 511,514| 484,448| 497,419| 340,429| 496,339| 320,45| 312,399| 293,251| 427,348| 404,356| 325,490| 94,317| 91,469| 496,56| 463,517| 467,41| 389,291| 310,439| 301,111| 201,397| 142,156| 371,157| 511,217| 177,447| 88,368| 80,455| 439,295| 66,37| 15,129| 234,363| 346,142| 329,65| 299,164| 214,455| 234,495| 469,513| 44,252| 322,92| 70,437| 21,523| 463,332| 362,78| 68,38| 287,67| 407,525| 461,251| 326,269| 9,14| 254,42| 87,44| 508,190| 21,509| 406,472| 480,137| 434,76| 192,98| 252,163| 322,295| 47,3| 182,347| 13,49| 454,73| 81,449| 339,17| 114,157| 378,253| 451,305| 345,132| 520,195| 217,296| 8,121| 526,7| 166,153| 286,38| 346,214| 219,439| 13,505| 467,504| 293,58| 390,334| 266,460| 418,493| 501,355| 516,182| 172,201| 302,223| 454,251| 313,407| 409,490| 219,67| 328,106| 413,91| 452,122| 512,294| 298,159| 70,163| 398,13| 243,267| 478,107| 176,502| 49,248| 316,73| 502,512| 235,215| 516,62| 127,214| 58,60| 265,487| 153,145| 410,122| 426,330| 92,321| 166,1| 216,251| 419,501| 33,233| 53,155| 401,275| 407,482| 297,240| 151,523| 70,305| 404,509| 116,418| 187,434| 353,335| 230,64| 478,101| 356,317| 349,131| 218,375| 246,261| 137,462| 326,118| 281,344| 216,369| 454,155| 296,311| 154,345| 97,281| 452,42| 323,355| 142,430| 267,5| 209,305| 475,277| 500,379| 21,88| 398,511| 209,152| 66,494| 116,460| 389,412| 46,299| 220,24| 443,407| 103,311| 366,398| 147,311| 66,499| 173,244| 476,152| 448,340| 27,349| 222,104| 6,415| 505,122| 81,64| 381,272| 448,362| 15,314| 368,142| 386,373| 253,305| 355,372| 25,379| 386,325| 53,256| 269,110| 158,174| 471,398| 486,410| 489,461| 293,460| 6,89| 152,73| 439,171| 298,100| 522,131| 181,122| 13,395| 113,152| 454,209| 197,10| 116,276| 249,117| 389,386| 403,127| 456,280| 284,384| 305,518| 267,514| 141,264| 244,214| 220,481| 328,22| 336,370| 283,356| 201,519| 439,268| 391,107| 436,167| 20,226| 121,127| 525,2| 198,363| 479,177| 145,352| 305,96| 526,54| 394,66| 365,427| 271,47| 67,11| 318,413| 114,481| 280,143| 14,422| 189,113| 291,298| 31,510| 284,202| 428,250| 63,303| 421,101| 275,464| 442,53| 366,251| 461,329| 440,200| 267,73| 315,459| 60,285| 396,207| 213,119| 54,356| 83,461| 305,344| 374,453| 468,47| 374,188| 29,314| 145,445| 64,391| 471,370| 328,398| 15,33| 222,258| 445,27| 427,188| 266,199| 82,216| 205,116| 163,305| 11,486| 270,415| 149,349| 61,257| 294,398| 491,431| 162,436| 5,73| 19,247| 289,223| 58,149| 424,508| 88,6| 196,494| 245,79| 239,437| 341,376| 492,349| 242,131| 345,235| 305,113| 92,129| 114,380| 402,319| 109,58| 34,87| 139,106| 234,361| 492,327| 28,411| 198,175| 155,149| 111,77| 219,229| 249,522| 38,46| 484,351| 304,425| 253,146| 490,3| 307,432| 276,4| 137,159| 390,122| 81,185| 455,231| 30,161| 412,186| 67,397| 393,344| 406,468| 410,212| 111,477| 446,349| 311,402| 406,101| 389,133| 486,59| 219,406| 188,23| 406,488| 483,19| 337,136| 5,105| 422,481| 170,516| 83,87| 14,520| 124,344| 479,508| 89,391| 447,95| 345,473| 334,366| 25,231| 327,497| 492,191| 408,5| 101,375| 8,212| 102,93| 41,4| 495,45| 206,228| 509,470| 365,169| 378,415| 67,463| 510,71| 419,358| 1,223| 158,514| 520,322| 137,250| 297,93| 197,30| 457,344| 214,519| 175,230| 477,188| 406,520| 65,451| 98,242| 13,265| 337,246| 413,513| 154,267| 300,444| 126,245| 347,67| 496,195| 523,479| 17,171| 412,362| 453,108| 13,178| 129,126| 479,317| 324,440| 221,51| 307,377| 245,252| 373,487| 222,217| 442,340| 402,66| 498,214| 454,52| 240,457| 214,411| 254,58| 292,145| 458,54| 314,198| 349,442| 215,141| 309,503| 187,372| 140,454| 336,412| 415,59| 383,300| 372,201| 286,174| 101,309| 418,304| 406,379| 312,23| 465,235| 174,159| 158,277| 455,10| 122,295| 237,94| 33,121| 13,109| 419,480| 303,483| 338,465| 469,426| 254,299| 450,208| 52,145| 90,188| 227,48| 108,432| 135,259| 313,228| 23,309| 458,421| 242,4| 179,256| 112,526| 121,456| 268,420| 350,17| 359,197| 238,383| 230,336| 208,398| 70,526| 508,229| 373,146| 95,355| 15,443| 420,144| 109,90| 191,370| 403,134| 295,441| 274,134| 341,328| 507,277| 350,266| 325,497| 436,478| 134,3| 13,214| 252,387| 61,419| 213,183| 450,451| 273,358| 43,401| 256,408| 402,344| 144,298| 107,257| 471,486| 85,51| 48,444| 167,182| 154,524| 421,48| 400,174| 208,113| 445,81| 445,482| 95,49| 30,315| 441,396| 106,204| 334,248| 429,206| 348,415| 255,407| 385,111| 380,238| 498,493| 203,525| 169,28| 427,487| 245,416| 169,401| 388,155| 138,115| 414,228| 478,73| 131,136| 270,130| 89,92| 134,496| 390,91| 381,156| 107,266| 64,2| 402,478| 316,249| 494,81| 478,389| 455,523| 342,313| 54,308| 340,439| 230,480| 269,180| 308,83| 283,414| 263,198| 262,388| 263,19| 303,394| 294,364| 81,381| 348,309| 57,36| 331,137| 90,233| 148,165| 171,232| 332,503| 177,493| 238,157| 342,275| 220,269| 276,442| 319,106| 66,178| 331,115| 270,183| 276,452| 319,209| 167,441| 44,417| 226,13| 200,113| 40,81| 55,438| 108,381| 42,224| 158,100| 281,238| 305,168| 24,218| 444,20| 366,85| 213,448| 359,526| 51,50| 163,307| 204,512| 130,386| 206,24| 348,337| 493,225| 93,190| 413,299| 78,387| 110,389| 290,437| 154,323| 143,193| 402,99| 486,85| 131,469| 389,250| 218,90| 96,448| 57,293| 189,435| 105,255| 190,34| 42,507| 16,263| 320,474| 270,366| 56,147| 292,211| 193,423| 76,129| 118,314| 261,102| 107,157| 434,134| 29,274| 510,264| 172,10| 80,184| 193,122| 222,234| 63,268| 321,89| 385,384| 369,204| 232,370| 410,8| 183,360| 133,330| 346,194| 276,153| 210,502| 312,466| 409,195| 435,269| 412,328| 332,466| 36,52| 276,150| 367,433| 343,67| 446,33| 206,1| 309,315| 80,497| 74,442| 469,97| 103,329| 184,288| 270,94| 197,129| 123,4| 453,242| 425,115| 472,28| 344,16| 390,264| 94,440| 119,428| 441,296| 175,90| 33,464| 269,362| 277,157| 525,210| 79,486| 160,323| 323,12| 18,177| 159,311| 299,262| 16,281| 288,16| 392,432| 141,314| 478,248| 233,509| 83,114| 181,340| 498,89| 334,108| 456,265| 166,218| 507,17| 513,391| 27,419| 485,179| 318,301| 125,357| 255,326| 132,450| 216,322| 332,64| 227,391| 453,176| 190,432| 246,93| 476,118| 243,287| 188,297| 100,460| 464,312| 416,48| 252,488| 55,515| 201,67| 180,133| 282,295| 252,433| 346,348| 43,145| 86,343| 73,59| 45,133| 218,418| 523,498| 267,262| 58,294| 171,53| 246,343| 26,278| 185,249| 291,365| 290,182| 108,135| 192,353| 213,202| 310,511| 243,127| 419,187| 479,401| 167,490| 193,354| 311,32| 295,506| 152,76| 315,240| 276,406| 366,261| 394,149| 376,455| 523,418| 400,47| 499,122| 504,502| 416,306| 140,258| 170,107| 263,404| 180,349| 46,511| 40,517| 365,162| 349,188| 17,363| 258,250| 360,494| 511,484| 386,362| 344,382| 31,433| 75,188| 220,129| 135,437| 309,404| 178,275| 20,3| 398,267| 347,499| 455,226| 283,434| 69,517| 314,250| 486,465| 344,319| 239,374| 400,96| 154,257| 186,484| 198,107| 115,219| 460,48| 323,246| 437,450| 252,517| 248,41| 472,201| 150,452| 131,407| 195,418| 510,16| 228,258| 242,5| 37,152| 32,211| 480,409| 388,272| 429,337| 365,144| 502,212| 474,45| 526,87| 371,192| 437,411| 335,10| 434,495| 334,46| 23,307| 282,5| 435,229| 286,426| 414,142| 472,255| 519,99| 257,260| 73,433| 114,76| 58,351| 68,102| 339,278| 464,247| 399,296| 338,305| 129,289| 206,135| 72,305| 498,389| 416,161| 156,233| 246,335| 134,468| 41,231| 488,218| 101,183| 398,486| 375,132| 330,155| 173,97| 13,73| 74,361| 304,184| 204,245| 50,469| 195,87| 49,184| 63,169| 319,279| 515,73| 46,193| 27,120| 484,229| 322,263| 436,203| 169,442| 82,171| 177,327| 502,358| 278,149| 360,454| 54,24| 157,230| 421,311| 495,111| 282,378| 499,281| 44,408| 476,51| 346,51| 116,525| 313,459| 205,402| 208,295| 220,506| 81,453| 168,75| 110,524| 12,25| 296,30| 30,130| 465,308| 236,467| 512,106| 521,324| 83,459| 508,350| 140,456| 84,443| 465,184| 463,268| 182,393| 419,10| 401,278| 57,158| 266,385| 486,143| 17,128| 328,244| 158,82| 385,164| 445,334| 416,32| 467,415| 218,89| 478,200| 39,67| 74,13| 464,457| 454,418| 118,401| 409,163| 231,139|]; order=[|310,1| 223,1| 110,1|];